package br.uvv.Service;

import java.io.Serializable;
import java.util.List;

import org.primefaces.model.SortOrder;

import br.uvv.Dao.ClientePortalDAO;
import br.uvv.Model.ClientePortal;
import br.uvv.Util.DAOException;
import br.uvv.Util.RNException;

public class ClientePortalService implements Serializable {

	private static final long serialVersionUID = 2310091665586839549L;
	
	private ClientePortalDAO clientePortalDao = new ClientePortalDAO();

	public List<ClientePortal> listarClientePortal() throws RNException {
		try {
			return clientePortalDao.listar();
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public ClientePortal selecionarClientePortal(Long id) throws RNException {
		try {
			return clientePortalDao.selecionar(id);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}
	
	public ClientePortal selecionarClientePortalComUsuarios(Long id) throws RNException {
		try {
			return clientePortalDao.selecionarComUsuarios(id);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public void removerClientePortal(ClientePortal clientePortalInstance) throws RNException {
		try {
			clientePortalDao.remover(clientePortalInstance);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public void atualizarClientePortal(ClientePortal clientePortalInstance) throws RNException {
		try {
			clientePortalDao.salvar(clientePortalInstance);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public void salvarClientePortal(ClientePortal clientePortalInstance) throws RNException {
		try {
			clientePortalDao.salvar(clientePortalInstance);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public List<ClientePortal> listarClientePortal(int first, int pageSize,
			String sortField, SortOrder sortOrder, String varBuscaClientePortal) throws RNException {
		return null;
	}

	public int countClientePortal(String varBuscaClientePortal) throws RNException {
		return 0;
	}

	public void excluir(ClientePortal clientePortalInstance) throws RNException {
		try {
			clientePortalDao.remover(clientePortalInstance);
		} catch (DAOException e) {
			throw new RNException(e);
		}
	}
}